﻿using DongFangGuoKai.WMSPlatform.Commn.ApiResultModule;
using DongFangGuoKai.WMSPlatform.Domain.Models;
using DongFangGuoKai.WMSPlatform.Service.LogApp;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;

namespace DongFangGuoKai.WMSPlatform.WebApi.Controllers.LogManage
{
    [Route("api/[controller]")]
    [ApiController]
    public class ApiLogController : ControllerBase
    {
        public readonly IAPILogService aPILogService;

        public ApiLogController(IAPILogService aPILogService)
        {
            this.aPILogService = aPILogService;
        }

        [HttpGet]
        [Route("GetListAsync")]
        public async Task<IActionResult> GetListAsync(int pageIndex, int pageSize)
        {
            var pageModel = new PageModel()
            {
                PageIndex = pageIndex,
                PageSize = pageSize
            };
            var data = await aPILogService.GetListAsync(pageModel);

            return Ok(new ApiDataResult<List<PMSLog>>()
            {
                Count = pageModel.TotalCount,
                Data = data,
                Code = 200,
                Success = true
            });
        }

    }
}
